//
//  YHYDesignRequireTableViewCell.m
//  Home
//
//  Created by 杨泓晔 on 16/5/9.
//  Copyright © 2016年 LanJue. All rights reserved.
//设计要求

#import "YHYDesignRequireTableViewCell.h"


@interface YHYDesignRequireTableViewCell ()
@property (nonatomic, strong)UILabel *xmLabel;
@property (nonatomic, strong)UIButton *chun;//纯设计
@property (nonatomic, strong)UIButton *build;
@property (nonatomic, strong)UIButton *budget;
/**
 *  跟单
 */
@property (nonatomic, strong)UIButton *single;//跟单


@end

@implementation YHYDesignRequireTableViewCell





- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
       
       
    }
    return self;
}


- (void)creatView{
    //名字
    self.xmLabel = [[UILabel alloc]init];
    //self.xmLabel.textColor = HS;
    self.xmLabel.textColor = LINE;
    self.xmLabel.font = [UIFont fontWithName:TFont size:TEXTCONTENTFONT2 * AUTO_WIDTH];
    
    [self.contentView addSubview:_xmLabel];
    [self.xmLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(3 * AUTO_HEIGHT);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(6*18.00*AUTO_WIDTH, 25.00*AUTO_HEIGHT));
    }];
    self.xmLabel.text = @"设计要求";
    
    
    
    
    
    UIImageView *imageL = [UIImageView new];
    imageL.image = [UIImage imageNamed:@"虚线"];
    [self.contentView addSubview:imageL];
    [imageL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_xmLabel.mas_bottom).offset(4 * AUTO_HEIGHT);
        make.left.mas_equalTo(8 * AUTO_WIDTH);
        make.right.mas_equalTo(self.contentView.mas_right).offset(- 8 * AUTO_WIDTH);
        make.height.mas_equalTo(1.5 * AUTO_HEIGHT);
        
    }];
    
    
    _chun = [UIButton new];
    [self.contentView addSubview:_chun];
    [_chun mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imageL.mas_bottom).offset(10 * AUTO_HEIGHT);
        make.left.mas_equalTo(_xmLabel);
        make.height.mas_equalTo(25 * AUTO_HEIGHT);
        make.width.mas_equalTo(70 * AUTO_WIDTH);
        
    }];
    _chun.backgroundColor = KH;
    _chun.layer.masksToBounds = YES;
    _chun.layer.cornerRadius = 4 * AUTO_WIDTH;
    [_chun setTitle:@"纯设计" forState:UIControlStateNormal];
    [_chun setTitleColor:ZI forState:UIControlStateNormal];
    _chun.tag = 1000;
    _chun.titleLabel.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    [_chun addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
    
    
    //预算
    _budget = [UIButton new];
    [self.contentView addSubview:_budget];
    [_budget mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_chun);
        make.left.mas_equalTo(_chun.mas_right).offset(22 * AUTO_WIDTH);
        make.size.mas_equalTo(_chun);
        
    }];
    _budget.backgroundColor = KH;
    _budget.layer.masksToBounds = YES;
    _budget.layer.cornerRadius = 4 * AUTO_WIDTH;
    [_budget setTitle:@"需要预算" forState:UIControlStateNormal];
    [_budget setTitleColor:ZI forState:UIControlStateNormal];
    _budget.titleLabel.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    _budget.tag = 1001;
    [_budget addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];


//施工
    _build = [UIButton new];
    [self.contentView addSubview:_build];
    [_build mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_chun);
        make.left.mas_equalTo(_budget.mas_right).offset(22 * AUTO_WIDTH);
        make.size.mas_equalTo(_chun);
        
    }];
    _build.backgroundColor = KH;
    _build.layer.masksToBounds = YES;
    _build.layer.cornerRadius = 4 * AUTO_WIDTH;
    [_build setTitle:@"需要施工" forState:UIControlStateNormal];
    [_build setTitleColor:ZI forState:UIControlStateNormal];
    _build.titleLabel.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    _build.tag = 1002;
    [_build addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];

    

    
    //需要跟单—
    _single = [UIButton new];
    [self.contentView addSubview:_single];
    [_single mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_chun);
        make.left.mas_equalTo(_build.mas_right).offset(22 * AUTO_WIDTH);
        make.size.mas_equalTo(_chun);
        
    }];
    _single.backgroundColor = KH;
    _single.layer.masksToBounds = YES;
    _single.layer.cornerRadius = 4 * AUTO_WIDTH;
    [_single setTitle:@"需要跟单" forState:UIControlStateNormal];
    [_single setTitleColor:ZI forState:UIControlStateNormal];
    _single.titleLabel.font = [UIFont fontWithName:TFont size:TEXTALITTLEFONT * AUTO_WIDTH];
    _single.tag = 1003;
    [_single addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];

    
}

- (void)button:(UIButton *)btu{
//    _iselect2 = NO;
//    _iselect3 = NO;
//    _iselect4 = NO;
    if (btu.tag == 1000) {
      
        [self btu:btu];
    }
    if (btu.tag == 1001) {
       
        [self btu:btu];
        
    }
    if (btu.tag == 1002) {
      
        [self btu:btu];
    }
    if (btu.tag == 1003) {
      
        [self btu:btu];
    }
    
}

- (void)btu:(UIButton *)btu{
    btu.selected = !btu.selected;
    if (!btu.selected) {
        [btu setTitleColor:ZI forState:UIControlStateNormal];
        btu.backgroundColor = KH;
    }
    else{
        [btu setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        btu.backgroundColor = GH;
    }
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
